package unit6.extractMethod;

import java.util.ArrayList;
import java.util.List;

public class Customer {

    String name;

    void printOwing() {
        printBanner();
        double outstanding = getOutstanding();
        printDetails(outstanding);
    }

    private double getOutstanding() {
        List<Order> orderList = new ArrayList<>();
        double result = 0.0;
        for (Order order : orderList) {
            result += order.getAmount();
        }
        return result;
    }

    private void printDetails(Double outstanding) {
        System.out.println("name:" + name);
        System.out.println("amount:" + outstanding);
    }

    private void printBanner() {
        System.out.println("***************************");
        System.out.println("****** Customer Owes ******");
        System.out.println("***************************");
    }

}
